<template>
  <div>
    <div class="button" @click="getApi">{{text}}</div>
    <el-button>xxx</el-button>
  </div>
</template>

<script>
export default {
  name: 'GFMyButton',
  props: {
    text: {
      type: String,
      required: true
    }
  },
  mounted () {
    // js代码中使用环境变量
    console.log('BASE_URL: ', process.env.BASE_URL);
  },
  data () {
    return {};
  },
  methods: {
    async getApi () {
      const response = await this.$http('/index');
      // if (res.meta.status !== 200) {
      //   this.$message.error('获取用户列表失败')
      // } else {
      //   this.$message.success('获取用户列表成功')
      // }
      console.log('response', response);
      // console.log('data', data)
    }
  }
};
</script>

<style lang='scss' scoped>
</style>
